package ru.spb.nicetu.schoolproject.gui;

import ru.spb.nicetu.schoolproject.TblModelForLessons;
import ru.spb.nicetu.schoolproject.data.Lesson;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;

/**
 * Created by dchernyshov on 25.04.15.
 */
public class ListOfLessonFrame extends CommonDialog<TblModelForLessons> {
    private JButton info;

    public ListOfLessonFrame() {
        super(new TblModelForLessons());
        setTitle("Расписание");
        info = new JButton("Доп. сведения");
        info.addActionListener(new BtnInfoListener());
        lastBox.add(Box.createHorizontalStrut(10));
        lastBox.add(info);
    }

    public ListOfLessonFrame(List<Lesson> lessonList) {
        super(new TblModelForLessons(lessonList));
        setTitle("Расписание");
    }

    public class BtnInfoListener implements ActionListener {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            JDialog dialog = new LessonReports();
            dialog.setVisible(true);
        }
    }
}
